import request from '../utils/request';

// 产值中心相关API
export const outputApi = {
  // 获取产值统计
  getOutputStatistics: (params) => {
    return request.get('/api/output/statistics', { params });
  },

  // 获取产值分配
  getOutputDistribution: (params) => {
    return request.get('/api/output/distribution', { params });
  },

  // 更新产值分配
  updateOutputDistribution: (data) => {
    return request.put('/api/output/distribution', data);
  },

  // 获取产值报表
  getOutputReports: (params) => {
    return request.get('/api/output/reports', { params });
  },

  // 生成产值报表
  generateOutputReport: (params) => {
    return request.post('/api/output/reports/generate', params);
  },

  // 下载产值报表
  downloadOutputReport: (reportId) => {
    return request.get(`/api/output/reports/${reportId}/download`, {
      responseType: 'blob'
    });
  },

  // 获取产值趋势
  getOutputTrend: (params) => {
    return request.get('/api/output/trend', { params });
  },

  // 获取部门产值
  getDepartmentOutput: (params) => {
    return request.get('/api/output/departments', { params });
  },

  // 获取个人产值
  getPersonalOutput: (params) => {
    return request.get('/api/output/personal', { params });
  },

  // 获取产值配置
  getOutputConfig: () => {
    return request.get('/api/output/config');
  },

  // 更新产值配置
  updateOutputConfig: (data) => {
    return request.put('/api/output/config', data);
  }
};
